<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<!--      <el-form-item label="中文名称-图谱" prop="chineseNameKg">-->
<!--        <el-input-->
<!--          v-model="queryParams.chineseNameKg"-->
<!--          placeholder="请输入中文名称-图谱"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
      <el-form-item label="中文名称" prop="chineseName">
        <el-input
          v-model="queryParams.chineseName"
          placeholder="请输入中文名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
<!--      <el-form-item label="英文名称-图谱" prop="englishNameKg">-->
<!--        <el-input-->
<!--          v-model="queryParams.englishNameKg"-->
<!--          placeholder="请输入英文名称-图谱"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
      <el-form-item label="英文名称" prop="englishName">
        <el-input
          v-model="queryParams.englishName"
          placeholder="请输入英文名称"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="国别" prop="nationality">
        <el-input
          v-model="queryParams.nationality"
          placeholder="请输入国别"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
<!--      <el-form-item label="部队层级-图谱" prop="unitLevelKg">-->
<!--        <el-input-->
<!--          v-model="queryParams.unitLevelKg"-->
<!--          placeholder="请输入部队层级-图谱"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="部队层级" prop="unitLevel">-->
<!--        <el-input-->
<!--          v-model="queryParams.unitLevel"-->
<!--          placeholder="请输入部队层级"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="部队隶属" prop="unitAffiliation">-->
<!--        <el-input-->
<!--          v-model="queryParams.unitAffiliation"-->
<!--          placeholder="请输入部队隶属"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="部队属性" prop="unitAttributes">-->
<!--        <el-input-->
<!--          v-model="queryParams.unitAttributes"-->
<!--          placeholder="请输入部队属性"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="司令官级别-图谱" prop="commanderLevelKg">-->
<!--        <el-input-->
<!--          v-model="queryParams.commanderLevelKg"-->
<!--          placeholder="请输入司令官级别-图谱"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="司令官级别" prop="commanderLevel">-->
<!--        <el-input-->
<!--          v-model="queryParams.commanderLevel"-->
<!--          placeholder="请输入司令官级别"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="现任指挥官-图谱" prop="currentCommanderKg">-->
<!--        <el-input-->
<!--          v-model="queryParams.currentCommanderKg"-->
<!--          placeholder="请输入现任指挥官-图谱"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="现任指挥官" prop="currentCommander">-->
<!--        <el-input-->
<!--          v-model="queryParams.currentCommander"-->
<!--          placeholder="请输入现任指挥官"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="历任指挥官-图谱" prop="commanderRankKg">-->
<!--        <el-input-->
<!--          v-model="queryParams.commanderRankKg"-->
<!--          placeholder="请输入历任指挥官-图谱"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="上级指挥机构-图谱" prop="superiorCommandInstitutionKg">-->
<!--        <el-input-->
<!--          v-model="queryParams.superiorCommandInstitutionKg"-->
<!--          placeholder="请输入上级指挥机构-图谱"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="上级指挥机构" prop="superiorCommandInstitution">-->
<!--        <el-input-->
<!--          v-model="queryParams.superiorCommandInstitution"-->
<!--          placeholder="请输入上级指挥机构"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="组织结构图，允许NULL值" prop="organizationStructureDiagram">-->
<!--        <el-input-->
<!--          v-model="queryParams.organizationStructureDiagram"-->
<!--          placeholder="请输入组织结构图，允许NULL值"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="部队驻地-图谱" prop="unitLocationKg">-->
<!--        <el-input-->
<!--          v-model="queryParams.unitLocationKg"-->
<!--          placeholder="请输入部队驻地-图谱"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="部队驻地" prop="unitLocation">-->
<!--        <el-input-->
<!--          v-model="queryParams.unitLocation"-->
<!--          placeholder="请输入部队驻地"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="规模，允许NULL值" prop="scale">-->
<!--        <el-input-->
<!--          v-model="queryParams.scale"-->
<!--          placeholder="请输入规模，允许NULL值"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
<!--      <el-form-item label="主要装备图谱" prop="mainEquipmentKg">-->
<!--        <el-input-->
<!--          v-model="queryParams.mainEquipmentKg"-->
<!--          placeholder="请输入主要装备图谱"-->
<!--          clearable-->
<!--          @keyup.enter.native="handleQuery"-->
<!--        />-->
<!--      </el-form-item>-->
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['business:power:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['business:power:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['business:power:remove']"
        >删除</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="powerList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="主键，自增" align="center" prop="id" show-overflow-tooltip />
      <el-table-column label="中文名称-图谱" align="center" prop="chineseNameKg" show-overflow-tooltip />
      <el-table-column label="中文名称" align="center" prop="chineseName" show-overflow-tooltip />
      <el-table-column label="英文名称-图谱" align="center" prop="englishNameKg" show-overflow-tooltip />
      <el-table-column label="英文名称" align="center" prop="englishName" show-overflow-tooltip />
      <el-table-column label="国别" align="center" prop="nationality" show-overflow-tooltip />
      <el-table-column label="部队类型" align="center" prop="unitType" show-overflow-tooltip />
      <el-table-column label="部队层级-图谱" align="center" prop="unitLevelKg" show-overflow-tooltip />
      <el-table-column label="部队层级" align="center" prop="unitLevel" show-overflow-tooltip />
      <el-table-column label="部队隶属" align="center" prop="unitAffiliation" show-overflow-tooltip />
      <el-table-column label="部队属性" align="center" prop="unitAttributes" show-overflow-tooltip />
      <el-table-column label="司令官级别-图谱" align="center" prop="commanderLevelKg" show-overflow-tooltip />
      <el-table-column label="司令官级别" align="center" prop="commanderLevel" show-overflow-tooltip />
      <el-table-column label="现任指挥官-图谱" align="center" prop="currentCommanderKg" show-overflow-tooltip />
      <el-table-column label="现任指挥官" align="center" prop="currentCommander" show-overflow-tooltip />
      <el-table-column label="历任指挥官-图谱" align="center" prop="commanderRankKg" show-overflow-tooltip />
      <el-table-column label="历任指挥官" align="center" prop="commanderRank" show-overflow-tooltip />
      <el-table-column label="上级指挥机构-图谱" align="center" prop="superiorCommandInstitutionKg" show-overflow-tooltip />
      <el-table-column label="上级指挥机构" align="center" prop="superiorCommandInstitution" show-overflow-tooltip />
      <el-table-column label="下属单位" align="center" prop="subordinateUnits" show-overflow-tooltip />
      <el-table-column label="组织结构图，允许NULL值" align="center" prop="organizationStructureDiagram" show-overflow-tooltip />
      <el-table-column label="部队驻地-图谱" align="center" prop="unitLocationKg" show-overflow-tooltip />
      <el-table-column label="部队驻地" align="center" prop="unitLocation" show-overflow-tooltip />
      <el-table-column label="主要职能" align="center" prop="mainDuties" show-overflow-tooltip />
      <el-table-column label="规模，允许NULL值" align="center" prop="scale" show-overflow-tooltip />
      <el-table-column label="主要装备图谱" align="center" prop="mainEquipmentKg" show-overflow-tooltip />
      <el-table-column label="主要装备" align="center" prop="mainEquipment" show-overflow-tooltip />
      <el-table-column label="前身历史" align="center" prop="frontHistory" show-overflow-tooltip />
      <el-table-column label="隶属单位变化" align="center" prop="subordinateUnitChanges" show-overflow-tooltip />
      <el-table-column label="社会评价与影响" align="center" prop="socialCommentsAndImpact" show-overflow-tooltip />
      <el-table-column label="部队预算情况" align="center" prop="unitBudgetConditions" show-overflow-tooltip />
      <el-table-column label="关键词" show-overflow-tooltip  align="center" prop="keywords" /
<!--      <el-table-column label="${comment}" align="center" prop="allInfo" />-->
      <el-table-column label="操作" fixed="right" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['business:power:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['business:power:remove']"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改战斗力量对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="1200px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="120px">
        <el-form-item label="中文名称-图谱" prop="chineseNameKg">
          <el-input v-model="form.chineseNameKg" placeholder="请输入中文名称-图谱" />
        </el-form-item>
        <el-form-item label="中文名称" prop="chineseName">
          <el-input v-model="form.chineseName" placeholder="请输入中文名称" />
        </el-form-item>
        <el-form-item label="英文名称-图谱" prop="englishNameKg">
          <el-input v-model="form.englishNameKg" placeholder="请输入英文名称-图谱" />
        </el-form-item>
        <el-form-item label="英文名称" prop="englishName">
          <el-input v-model="form.englishName" placeholder="请输入英文名称" />
        </el-form-item>
        <el-form-item label="国别" prop="nationality">
          <el-input v-model="form.nationality" placeholder="请输入国别" />
        </el-form-item>
        <el-form-item label="部队层级-图谱" prop="unitLevelKg">
          <el-input v-model="form.unitLevelKg" placeholder="请输入部队层级-图谱" />
        </el-form-item>
        <el-form-item label="部队层级" prop="unitLevel">
          <el-input v-model="form.unitLevel" placeholder="请输入部队层级" />
        </el-form-item>
        <el-form-item label="部队隶属" prop="unitAffiliation">
          <el-input v-model="form.unitAffiliation" placeholder="请输入部队隶属" />
        </el-form-item>
        <el-form-item label="部队属性" prop="unitAttributes">
          <el-input v-model="form.unitAttributes" placeholder="请输入部队属性" />
        </el-form-item>
        <el-form-item label="司令官级别-图谱" prop="commanderLevelKg">
          <el-input v-model="form.commanderLevelKg" placeholder="请输入司令官级别-图谱" />
        </el-form-item>
        <el-form-item label="司令官级别" prop="commanderLevel">
          <el-input v-model="form.commanderLevel" placeholder="请输入司令官级别" />
        </el-form-item>
        <el-form-item label="现任指挥官-图谱" prop="currentCommanderKg">
          <el-input v-model="form.currentCommanderKg" placeholder="请输入现任指挥官-图谱" />
        </el-form-item>
        <el-form-item label="现任指挥官" prop="currentCommander">
          <el-input v-model="form.currentCommander" placeholder="请输入现任指挥官" />
        </el-form-item>
        <el-form-item label="历任指挥官-图谱" prop="commanderRankKg">
          <el-input v-model="form.commanderRankKg" placeholder="请输入历任指挥官-图谱" />
        </el-form-item>
        <el-form-item label="历任指挥官" prop="commanderRank">
          <el-input v-model="form.commanderRank" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="上级指挥机构-图谱" prop="superiorCommandInstitutionKg">
          <el-input v-model="form.superiorCommandInstitutionKg" placeholder="请输入上级指挥机构-图谱" />
        </el-form-item>
        <el-form-item label="上级指挥机构" prop="superiorCommandInstitution">
          <el-input v-model="form.superiorCommandInstitution" placeholder="请输入上级指挥机构" />
        </el-form-item>
        <el-form-item label="下属单位" prop="subordinateUnits">
          <el-input v-model="form.subordinateUnits" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="组织结构图，允许NULL值" prop="organizationStructureDiagram">
          <el-input v-model="form.organizationStructureDiagram" placeholder="请输入组织结构图，允许NULL值" />
        </el-form-item>
        <el-form-item label="部队驻地-图谱" prop="unitLocationKg">
          <el-input v-model="form.unitLocationKg" placeholder="请输入部队驻地-图谱" />
        </el-form-item>
        <el-form-item label="部队驻地" prop="unitLocation">
          <el-input v-model="form.unitLocation" placeholder="请输入部队驻地" />
        </el-form-item>
        <el-form-item label="主要职能" prop="mainDuties">
          <el-input v-model="form.mainDuties" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="规模，允许NULL值" prop="scale">
          <el-input v-model="form.scale" placeholder="请输入规模，允许NULL值" />
        </el-form-item>
        <el-form-item label="主要装备图谱" prop="mainEquipmentKg">
          <el-input v-model="form.mainEquipmentKg" placeholder="请输入主要装备图谱" />
        </el-form-item>
        <el-form-item label="主要装备" prop="mainEquipment">
          <el-input v-model="form.mainEquipment" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="前身历史" prop="frontHistory">
          <el-input v-model="form.frontHistory" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="隶属单位变化" prop="subordinateUnitChanges">
          <el-input v-model="form.subordinateUnitChanges" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="社会评价与影响" prop="socialCommentsAndImpact">
          <el-input v-model="form.socialCommentsAndImpact" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="部队预算情况" prop="unitBudgetConditions">
          <el-input v-model="form.unitBudgetConditions" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="关键词" prop="keywords">
          <el-input v-model="form.keywords" type="textarea" placeholder="请输入内容" />
        </el-form-item>
<!--        <el-form-item label="${comment}" prop="allInfo">-->
<!--          <el-input v-model="form.allInfo" type="textarea" placeholder="请输入内容" />-->
<!--        </el-form-item>-->
      </el-form>
      <el-form ref="formfj" label-width="120px">
        <el-form-item label="图片" prop="ysSm">
          <div>
            <FileUpload
              v-if="open"
              ref="expertRef"
              :disabled="true"
              :businessId="form.id"
              :business-type="'image'"
              :biz-type="'download'"
              :limit="1"
              style="margin-left: 20px"
              table-type="7"
            ></FileUpload>
          </div>
        </el-form-item>
      </el-form>
      <el-form ref="formfj" label-width="120px">
        <el-form-item label="原文件" prop="ysSm">
          <div>
            <FileUpload
              v-if="open"
              ref="expertRef"
              :disabled="true"
              :businessId="form.id"
              :business-type="'bz001'"
              :biz-type="'download'"
              :limit="1"
              :file-size="200"
              :file-type="['pdf']"
              style="margin-left: 20px"
              table-type="7"
            ></FileUpload>
          </div>
        </el-form-item>
      </el-form>

      <el-form ref="formfj" label-width="120px">
        <el-form-item label="译文文件" prop="ysSm">
          <div>
            <FileUpload
              v-if="open"
              ref="expertRef"
              :disabled="true"
              :businessId="form.id"
              :business-type="'bz002'"
              :biz-type="'download'"
              :limit="1"
              :file-size="200"
              :file-type="['pdf']"
              style="margin-left: 20px"
              table-type="7"
            ></FileUpload>
          </div>
        </el-form-item>

      </el-form>
      <el-form ref="formfj" label-width="120px">
        <el-form-item label="精翻文件" prop="ysSm">
          <div>
            <FileUpload
              v-if="open"
              ref="expertRef"
              :disabled="true"
              :businessId="form.id"
              :business-type="'bz003'"
              :biz-type="'download'"
              :limit="1"
              :file-size="200"
              :file-type="['pdf']"
              style="margin-left: 20px"
              table-type="7"
            ></FileUpload>
          </div>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { listPower, getPower, delPower, addPower, updatePower } from "@/api/business/power";
import FileUpload from '@/components/fileUpload_neww.vue'
import {  saveUpdateFile  } from "@/api/business/file";

import { guid } from '@/utils/utils'
import Pictures from '@/components/Pictures'
export default {
  name: "Power",
  components: { Pictures,FileUpload },
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 战斗力量表格数据
      powerList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        chineseNameKg: null,
        chineseName: null,
        englishNameKg: null,
        englishName: null,
        nationality: null,
        unitType: null,
        unitLevelKg: null,
        unitLevel: null,
        unitAffiliation: null,
        unitAttributes: null,
        commanderLevelKg: null,
        commanderLevel: null,
        currentCommanderKg: null,
        currentCommander: null,
        commanderRankKg: null,
        commanderRank: null,
        superiorCommandInstitutionKg: null,
        superiorCommandInstitution: null,
        subordinateUnits: null,
        organizationStructureDiagram: null,
        unitLocationKg: null,
        unitLocation: null,
        mainDuties: null,
        scale: null,
        mainEquipmentKg: null,
        mainEquipment: null,
        frontHistory: null,
        subordinateUnitChanges: null,
        socialCommentsAndImpact: null,
        unitBudgetConditions: null,
        keywords: null,
        allInfo: null
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        chineseName: [
          { required: true, message: "中文名称不能为空", trigger: "blur" }
        ],
        englishName: [
          { required: true, message: "英文名称不能为空", trigger: "blur" }
        ],
        nationality: [
          { required: true, message: "国别不能为空", trigger: "blur" }
        ],
        unitType: [
          { required: true, message: "部队类型不能为空", trigger: "change" }
        ],
        unitLevel: [
          { required: true, message: "部队层级不能为空", trigger: "blur" }
        ],
        unitAffiliation: [
          { required: true, message: "部队隶属不能为空", trigger: "blur" }
        ],
        unitAttributes: [
          { required: true, message: "部队属性不能为空", trigger: "blur" }
        ],
        currentCommander: [
          { required: true, message: "现任指挥官不能为空", trigger: "blur" }
        ],
        commanderRank: [
          { required: true, message: "历任指挥官不能为空", trigger: "blur" }
        ],
        superiorCommandInstitution: [
          { required: true, message: "上级指挥机构不能为空", trigger: "blur" }
        ],
        subordinateUnits: [
          { required: true, message: "下属单位不能为空", trigger: "blur" }
        ],
        unitLocation: [
          { required: true, message: "部队驻地不能为空", trigger: "blur" }
        ],
        mainDuties: [
          { required: true, message: "主要职能不能为空", trigger: "blur" }
        ],
        mainEquipment: [
          { required: true, message: "主要装备不能为空", trigger: "blur" }
        ],
        frontHistory: [
          { required: true, message: "前身历史不能为空", trigger: "blur" }
        ],
        subordinateUnitChanges: [
          { required: true, message: "隶属单位变化不能为空", trigger: "blur" }
        ],
        socialCommentsAndImpact: [
          { required: true, message: "社会评价与影响不能为空", trigger: "blur" }
        ],
        unitBudgetConditions: [
          { required: true, message: "部队预算情况不能为空", trigger: "blur" }
        ],
        keywords: [
          { required: true, message: "关键词不能为空", trigger: "blur" }
        ],
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询战斗力量列表 */
    getList() {
      this.loading = true;
      listPower(this.queryParams).then(response => {
        this.powerList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        chineseNameKg: null,
        chineseName: null,
        englishNameKg: null,
        englishName: null,
        nationality: null,
        unitType: null,
        unitLevelKg: null,
        unitLevel: null,
        unitAffiliation: null,
        unitAttributes: null,
        commanderLevelKg: null,
        commanderLevel: null,
        currentCommanderKg: null,
        currentCommander: null,
        commanderRankKg: null,
        commanderRank: null,
        superiorCommandInstitutionKg: null,
        superiorCommandInstitution: null,
        subordinateUnits: null,
        organizationStructureDiagram: null,
        unitLocationKg: null,
        unitLocation: null,
        mainDuties: null,
        scale: null,
        mainEquipmentKg: null,
        mainEquipment: null,
        frontHistory: null,
        subordinateUnitChanges: null,
        socialCommentsAndImpact: null,
        unitBudgetConditions: null,
        keywords: null,
        allInfo: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加战斗力量";
      let mizId = guid().replace(/-/g, '');
      this.form.id = mizId
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      getPower(id).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改战斗力量";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updatePower(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addPower(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除战斗力量编号为"' + ids + '"的数据项？').then(function() {
        return delPower(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('business/power/export', {
        ...this.queryParams
      }, `power_${new Date().getTime()}.xlsx`)
    }
  }
};
</script>
